package com.bicon.botu.mall.goods.controller;

import com.bicon.botu.mall.goods.processor.service.ProductSyncService;
import com.bicon.botu.core.base.common.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * <p> 产品信息同步api
 * </p>
 *
 * @author tao.zeng.
 * @since 2018/3/15.
 */
@RestController
@RequestMapping("/V2.0.0/static/product")
public class ProductSyncController extends BaseController {

    @Autowired
    private ProductSyncService productSyncService;

    @RequestMapping("/sync")
    public String sync(String startDate, String endDate) {
        String whereSql = " update_date BETWEEN '" + startDate + "' and   '" + endDate + "'";
        productSyncService.syncProduct(whereSql);
        productSyncService.syncProductRepertory(whereSql);
        return "success";
    }
}
